package collection;

import java.util.*;

public class Test3 {
    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        Random random=new Random();
        for (int i = 0; i <10 ; i++) {
            list.add(random.nextInt(100)+1);
        }
        //大到小排序
        System.out.println(list);
        Collections.sort(list, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2-o1;
            }
        });

//        Collections.sort(list);
//        Collections.reverse(list);

        System.out.println(list);


    }
}
